﻿<%@page contentType="text/html;charset=UTF-8" %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<%@page import="org.openrdf.model.URI" %><%@page import="be.destin.skos.core.SkosManager" %><%--
--%><%@page import="be.destin.skos.html.SkosHtmlManager" %><%--
--%><%@page import="be.destin.skos.html.SkosHtmlTable" %><%--
--%><%@page import="be.destin.skos.html.LocalError" %><%--
--%><%@page import="be.destin.skos.core.SchemeInterface" %><%--
--%><%@page import="be.destin.skos.core.SchemeUsage" %><%--
--%><%@page import="be.destin.skos.core.ConceptScheme" %><%--
--%><%@page import="be.destin.skos.core.CollectionScheme" %><%--
--%><%@page import="be.destin.skos.core.Concept" %><%--
--%><%@page import="be.destin.skos.core.Application" %><%--
--%><%@page import="be.destin.skos.core.Term" %><%--
--%><%@page import="be.destin.skos.core.TermList" %><%--
--%><%@page import="be.destin.skos.core.Url" %><%--
--%><%@page import="be.destin.skos.core.Notation" %><%--
--%><%@page import="be.destin.skos.core.ReferringApplicationList" %><%--
--%><%@page import="be.destin.skos.core.LinkedConcept" %><%--
--%><%@page import="be.destin.skos.core.LocalLinkedConcept" %><%--
--%><%@page import="be.destin.skos.view.SkosView" %><%--
--%><%@page import="be.destin.skos.view.SkosViewType" %><%--
--%><%@page import="be.destin.skos.view.SkosViewManager" %><%--
--%><%@page import="be.destin.rdf.changes.StatusFilter" %><%--
--%><%@page import="be.destin.rdf.changes.Status" %><%--
--%><%@page import="be.destin.util.RunCommand" %><%--
--%><%@page import="be.destin.util.Util" %><%--
--%><%@page import="be.destin.memo.Log" %><%--
--%><%@page import="be.destin.memolog.UsageLogger" %><%--
--%><%@page import="be.destin.memolog.UsageMode" %><%--
--%><%@page import="be.destin.memo.TagDef" %><%@page import="be.destin.memo.Tagged" %><%--
--%><%@page import="be.destin.beans.Reflector" %><%--
--%><%@page import="java.util.List" %><%--
--%><%@page import="java.util.Map" %><%--
--%><%@page import="java.util.List" %><%--
--%><%@page import="java.util.LinkedList" %><%--
--%><%@page import="java.util.HashSet" %><%--
--%><%@page import="java.util.LinkedHashSet" %><%--
--%><%@page import="java.util.TreeMap" %><%--
--%><%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %><%--
--%><%	 
   SkosHtmlManager skosHtmlManager = SkosHtmlManager.getAskosiSessionInstance(request);
   SkosManager skosManager = skosHtmlManager.getSkosManager();
   String language = skosHtmlManager.getLanguage();
   String conceptCode = request.getParameter("concept");
   String independant = request.getParameter("independant");
   String framing = request.getParameter("framed");
   boolean framed = framing != null && framing.equalsIgnoreCase("yes");
   if (independant != null && independant.equalsIgnoreCase("yes")) framed = false;
   framing = "";
   if (framed) framing = "&framed=yes";
   String fixingPage = request.getParameter("fixed");
   boolean fixedPages = fixingPage != null && fixingPage.equalsIgnoreCase("yes");
   if (fixedPages) framing = framing+"&fixed=yes";
   String expanding = request.getParameter("expanded");
   boolean expanded = expanding != null && expanding.equalsIgnoreCase("yes");
   String editing = request.getParameter("edit");
   boolean edit = editing != null && editing.equalsIgnoreCase("yes");
   RunCommand runGraf;
   String graf = request.getParameter("graf");
   if (graf==null) graf = "";
   String grafocus = request.getParameter("grafocus");
   String relfocus = request.getParameter("relfocus");
   boolean isrelfocus = relfocus != null && !relfocus.isEmpty();
   String schemeCode = "";
   String loadUsage = request.getParameter("loadusage");
   boolean isloadusage = loadUsage != null && !loadUsage.isEmpty();
%>
<html>
<head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
		<meta http-equiv="X-UA-Compatible" content="IE=8">
<link rel="shortcut icon" href="image/tulipevertepetite.png" >
<link rel="schema.DC" href="http://purl.org/DC/elements/1.1/">
<link rel="home" href="<%= request.getContextPath() %>" title="Home"/>
<link rel="index" href="<%= request.getContextPath() %>" title="Index"/>
<%--link rel="author" href="http://www.cdmc68.com" title="Author"/>
<link rel="copyright" href="http://www.cdmc68.com" title="Copyright"/--%>
<link rel="help" href="http://www.destin.be/ASKOSI" title="Help"/>
<link rel="shortcut icon" href="<%= request.getContextPath() %>/favicon.ico" type="image/x-icon"/>
<%--	if (locbar) {
		List parentTitles = (List) request.getAttribute("dspace.layout.parenttitles");
		List parentLinks = (List) request.getAttribute("dspace.layout.parentlinks");
		if (parentTitles.size() > 0) {
			String s = (String) parentTitles.get(parentTitles.size()-1);
			String u = (String) parentLinks.get(parentLinks.size()-1);
			if (!u.equals("")) {
%><link rel="up" href="<%= request.getContextPath() %><%= u %>" title="<%= s %>"/><%
			}
		}
	}
--%>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/askosi.css" />
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/jqueryui.css" />
<style type="text/css">
 .ui-autocomplete {
		max-height: 200px;
		overflow-y: auto;
		/* prevent horizontal scrollbar */
		overflow-x: auto;
		/* add padding to account for vertical scrollbar */
		padding-right: 20px;
	}
	/* IE 6 doesn't support max-height
	 * we use height instead, but this forces the menu to always be this tall
	 */
	* html .ui-autocomplete {
		height: 100px;
	}
 
</style>
<title>Concept <%=conceptCode%></title>

    <script type="text/javascript" src="js/jquery-1.7.2.js"></script>
	<script type="text/javascript" src="js/jquery-ui-1.8.23.custom.js"></script>
    <script type="text/javascript" src="js/sessvars.js"></script>
    <script type="text/javascript" src="js/tablescroll.js"></script>
    <script type="text/javascript">
    sessvars.contextPath = "<%= request.getContextPath() %>";
	headerHeight=100;

	var prevItem = null;

	function closePanel() {
		if (prevItem != null) {
			//prevItem.style.display = 'none';
			//prevItem.css ( {'display':'none'} );
			prevItem.hide();
			prevItem = null;
		}
	}

	function showPanel(event,url,aContainer,aTarget) {
		// IE is evil and doesn't pass the event object
		if (event === null) {
			event = window.event;
		}

		// we assume we have a standards compliant browser, but check if we have IE
		var clicked = $(event.target || event.srcElement);//.parents('a')[0];
		/*
		while (clicked !== null && clicked.tagName!='A' ) {
			clicked = $(clicked.parentNode);
		} // Attention: parentNode et offsetParent, pas la meme chose!
		*/
        // hide the menu first to avoid an "up-then-over" visual effect
		var cell = $(aTarget);
		if (cell != null && clicked != null) {
			closePanel();
			var _divContext = $(aContainer);
			/*
			var e = clicked;
			var aleft = 0;
			var atop = 0;
			/*Remonter tous les élements parents pour calculer la position dans la page
			while (e.offsetParent !== undefined && e.offsetParent !== null)	{
				atop += e.offsetTop;
				aleft += e.offsetLeft;
				e = $(e.offsetParent);
			}
			*/
			var aoffset = clicked.offset();
			var atop = aoffset.top+clicked.height()+2;
			var aleft = aoffset.left;
			_divContext.css ( {'top':atop+'px', 'left':aleft+'px'} );
			_divContext.show();
			prevItem = _divContext;
			cell.html ('loading '+url+'...');
			//alert (url);
			cell.load(url);
			/* Would need to divide Concept page in anchored sections...
			if ($(aTarget.parentNode.parentNode).viewportOffset().top < 0) {
				location.hash=handle;
			} */
		}
	}
/*
	function ajaxpage(url, containerid){
		var page_request = new Ajax.Updater(containerid,url,{method:'get',evalScripts:true});
	}
*/
	function editStatement(event,parameters) {
		var urlEdit = '<%=request.getContextPath()%>/editconcept.jsp?about='+parameters.about
					+'<%=framing%>&property='+parameters.property
					+'&adding='+parameters.adding
					+'&concept='+parameters.concept
					+'&notation='+parameters.notation
					+'&literallanguage='+parameters.literallanguage
					+'&literal='+parameters.literal
					//+'&timestamp='+(new Date())
					;
		showPanel(event,urlEdit,'#statement','#editStatement');
	}
</script>
</head>
<%
   int maxDepth = 0;
   String mainTitle = "";
   Concept aConcept = (Concept)skosManager.getScheme_Concept(conceptCode);
   if (aConcept != null) {
	   if (aConcept instanceof Application && isloadusage) {
		  ((Application)aConcept).loadUsages();
	   }
	    UsageLogger usageLogger = new UsageLogger(request,SkosHtmlManager.askosiDisplayApplication,conceptCode,UsageMode.DISPLAY);
  	    usageLogger.start();
		SkosHtmlManager.maintainRecentConcepts(request,conceptCode,0);
        ConceptScheme aScheme = aConcept.getInScheme();
		String schemaOrg = null;
		if (aScheme != null) {
			schemeCode = aScheme.getAbout();
		 	if (aScheme.isHierarchized()) {
				maxDepth = aScheme.getMaxDepth();
			}
			mainTitle = aScheme.getTitle(language);
			schemaOrg = aScheme.toUriSchemaOrg();
		}
	    Status status = aConcept.getCurrentStatus();
		if (status == null) status = Status.Published;
		String statusCode = status.toHtml(skosHtmlManager);
%>
<body class="contentpage">
<div id="header">
<%String pageID = "CONCEPT";%><%@include file="basket.jnc"%>
<div id="currentConcept">
<%--a onclick='javascript:skosBasketToggle("<%=aConcept.getScheme_About()%>","topSkosBasket")'><img name="topSkosBasket<%=aConcept.getScheme_About()%>"/></a><script type="text/javascript">skosBasketLoad("<%=aConcept.getScheme_About()%>","topSkosBasket");</script--%>
<a href="<%=request.getContextPath()%>/histconcept.jsp?concept=<%=aConcept.getScheme_About()%>"><%=statusCode%></a>
<big style="border:1px solid black; padding:5px 12px 5px 8px;"><img src="image/concept16.gif" border="0"/><tt><a href="view.jsp?scheme=<%=aScheme.getAbout()%><%=framing%>"<%-- target="askosi_scheme"--%>><%=skosHtmlManager.toHtmlImage(aScheme.getIconAdapted(skosHtmlManager),aScheme.getAbout(),false)%><%=aScheme.getAbout()%></a>_<%=aConcept.getAbout()%></tt>
 <%=skosHtmlManager.toHtmlImage(aConcept.getIconAdapted(skosHtmlManager),aConcept.getAbout(),false)%></big>
<%
	      if (!edit) {
			%><a href="<%=aConcept.getAskosiUrl(skosHtmlManager,"&edit=yes")%>"><img<%=skosHtmlManager.askosiIcon("edit")%> border="0"/></a><%
		  }
		  if (aConcept.getUrl() != null) {
		for (Url anUrl: aConcept.getUrl()) {
	      %> &nbsp; <a href="<%=anUrl.getValue()%>" target="conceptURL"><%if (anUrl.getLang()!=null){%><span class="language"><%=anUrl.getLang()%></span> <%}%><%=anUrl.getValue()%></a> &nbsp; <%
		}
      }
%> &nbsp; <%=aConcept.getDepth() > 0 ? " &#8615;"+aConcept.getDepth() : ""%>
<a href="glispbrowse.jsp?url=/scheme/concept.svc/<%=aScheme.getAbout()%>(<%=aConcept.getAbout()%>)" target="_blank"><img src="image/16x16/freelance.png" border="0" class="linkaction"/></a>
</div><%@include file="schemetitle.jnc"%><p> &nbsp; </p><%
	String displayInSource = aScheme.getDisplayAdapted(skosHtmlManager,aConcept);
	if (displayInSource != null && !displayInSource.isEmpty()) {
		%><span style="background-color:#e0ffe0; border:solid 1px black; margin:6px; text-align:center"><a target="_blank" href="<%=displayInSource%>">Concept Discussion</a></span><%
	}
	if ("c".equals(aScheme.getAbout())) {
	%><span style="background-color:#e0ffe0; border:solid 1px black; margin:6px; text-align:center"><a target="_blank" href="http://agris.fao.org/agris-search/searchIndex.action?query=&agrovocToAdd=<%=aConcept.getPrefLabel("en",false)%>&request_locale=en">&nbsp;Search in AGRIS&nbsp;</a></span><%
	}
	if ("jita".equals(aScheme.getAbout())) {
	%><span style="background-color:#e0ffe0; border:solid 1px black; margin:6px; text-align:center"><%
	  if (aConcept.getUrl() != null) {
		for (Url anUrl: aConcept.getUrl()) {
	      %> &nbsp; <a href="<%=anUrl.getValue()%>" target="conceptURL"><span class="language"><%=anUrl.getLang()%></span>Search in E-LIS</a> &nbsp; <%
		} }%></span><%
	}
    if (aConcept instanceof Application && !isloadusage) {
	%><span style="background-color:#e0ffe0; border:solid 1px black; margin:6px; text-align:center"><%
	      %> &nbsp; <a href="<%=request.getContextPath()%>/concept.jsp?concept=<%=aConcept.getScheme_About()%>&loadusage=1">(re)load usages</a> &nbsp; </span><%
	}%></div><div id="content"<% if (schemaOrg != null) {
		%> itemscope itemid="<%=aConcept.getAskosiUrl(skosHtmlManager,"")%>" itemtype="<%=schemaOrg%>"<%
	}%>><img src="image/carrevide.gif" height="100" border="0" alt="top margin"/><br style="clear:both"/>
 	<%-- fixedPages: no format button
		 normal(default): surrounding with all specifics: no relations displayed here
		 edit: surrounding with NO relations. Here we include all relations for editing.
	     graf: surrounding with NO relations. The graf already shows all relations: no relations displayed here
		 expanded: surrounding with NO specific relations + the complete hierarchical table: no relations displayed here--%>
	<% int maxRel = (expanded?0:(edit?-1:(graf.isEmpty()?9999:-1))); %>
	<%=skosHtmlManager.toHtmlSurroundings(aConcept.getScheme_About(), null, maxRel, false,true)%>
	<%
		  SkosView aView = SkosViewManager.openView (skosHtmlManager, aScheme.getAbout(), SkosViewType.TREE, language, false, null);
	      SkosHtmlTable skosHtmlTable = new SkosHtmlTable(skosHtmlManager,aView);
	      skosHtmlTable.setColSpanning(expanded);
	      skosHtmlTable.setBasket(true);
	      int nbColumns = skosHtmlTable.putScheme(aScheme);
	      aView.setPivot(aConcept.getAbout());

	      if (!graf.isEmpty()) {
			String imageFormat = "png"; //"svg";
			String precLang = language;
			language = graf;
			skosHtmlManager.setLanguage(language);
			aView.setBroadContext(grafocus);
			LinkedList<String> nodes = new LinkedList<String>();
		    boolean RTL = TermList.isRTL(language);
			String input = "digraph G {\n"
									+"label=\"Concept "
									+conceptCode
									+" (displayed using ASKOSI.org)\";\n"
									+"node [fontname=\"Arial\" shape=box style=filled fillcolor=white];\n"
									+"fontname=\"Arial\";\n"
									+"rankdir="
									+(RTL?"RL":"LR")
									+";\n"
									+"ranksep=0.3;\n"
									+"nodesep=0.15;\n"
									+"ratio=compress;\n"
									+"concentrate=true;\n"
									+"size=\"11,1000\";\n"
									//+"splines=ortho;\n"
									+"stylesheet=\""
									+request.getContextPath()
									+"/css/graf.css\"\n"
									+"subgraph cluster_Main{\n"
									+"label=\"\";\n"
									+"bgcolor=grey91;\n"
									+aScheme.getAbout()
									+"[shape=house,URL=\""
									+request.getContextPath()
									+"/view.jsp?scheme="
									+aScheme.getAbout()
									+framing
									+"\",label=\""
									+Util.glue(Util.wordWrap(aScheme.getTitle(language),20),"\\n")
									+"\",id=\""
									+aScheme.getAbout()
									+"\" style=filled fillcolor=lightblue];\n"
								+ SkosViewManager.toDotHierarchy(skosHtmlManager,aView,nodes)
						+ SkosViewManager.toDotLabels(skosHtmlManager,aView,nodes,15,false/*include notes*/,"svg".equals(imageFormat))
						+ "}}\n";
			%><!--DOT Input=<%=input%>--><%
			String[] commands = {SkosHtmlManager.getGraphVizExec(request),
								"-Kdot", "-T"+imageFormat,
								"-o\""+SkosHtmlManager.getGraphVizDirectory(request)+"[seq]."+imageFormat+"\"",
								"svg".equals(imageFormat)?"":"-Tcmapx"};
			runGraf = new RunCommand(SkosHtmlManager.getGraphVizDirectory(request),commands,null);
			runGraf.setInput(input);
			runGraf.run();
			%><!--Errors=<%=runGraf.getErrors()%>-->
			<div style="position: absolute; margin-top:-100px;"><a name="Graf"></a></div>
			<p><%
			  if (aView.hasBroadContext()) {
				    Concept grafConcept = skosManager.getScheme_Concept(aView.getBroadContext());
				    if (grafConcept != null) { %><big>Graph under <%=grafConcept.toHtmlLabel(skosHtmlManager)%> :</big><br/><% }
			  }
			  if (!"svg".equals(imageFormat)) {
			%><img border="1" src="<%=request.getContextPath()%>/graf/<%=runGraf.getSequence()%>.<%=imageFormat%>" usemap="#G"/><%=runGraf.getOutput()%><%
			  } else {
			%><object type="image/svg+xml" border="1" width="1024" height="1024" data="<%=request.getContextPath()%>/graf/<%=runGraf.getSequence()%>.<%=imageFormat%>" style="background-color:white;">SVG files not supported: please switch to PNG</object><%
			  }
			%></p><%
			language = precLang;
			skosHtmlManager.setLanguage(language);
	      }

    	  int nbLink = aConcept.getBroader().size();
    	  nbLink += aConcept.getBroadMatch().size();
    	  nbLink += aConcept.getNarrower().size();
    	  nbLink += aConcept.getNarrowMatch().size();

    	  if (expanded) {
				    %><div style="position: absolute; margin-top:-100px;"><a name="hierarchy"></a></div>
				    <table cellspacing="0" class="tableWithFloatingHeader"><col/><col/><%=skosHtmlTable.toHtmlColGroups()%>
				    <%skosHtmlTable.initRow();%>
				      <tr class="<%=(skosHtmlTable.nextRowClass())%>">
						  <th>&nbsp;</th>
						  <th>&nbsp;</th>
						  <th<%=skosHtmlTable.toHtmlWholeSpan()%>> <%=skosHtmlManager.toHtmlImage(aScheme.getIconAdapted(skosHtmlManager),aScheme.getAbout(),false)%> <%=aScheme.getTitle(language)%> </th>
						  <%=skosHtmlTable.toHtmlApplicationHeaders()%>
				      </tr>
				      <tr class="<%=skosHtmlTable.nextRowClass()%>">
						  <th>&nbsp;</th>
						  <th class="math"><%if (skosHtmlTable.isHierarchized() || !expanded) {%>&#8615;<%}%></th>
						  <th<%=skosHtmlTable.toHtmlWholeSpan()%>>&nbsp;</th>
					  <%=skosHtmlTable.toHtmlRoleHeaders()%>
				      </tr><%
				      if (expanded) {
						SkosViewManager.toHtmlTableOut(out, aView, skosHtmlTable);
				      } else {
						%><tr class="<%=(skosHtmlTable.nextRowClass())%>">
							    <td class="SkosStatusConcept"><%=aConcept.toHtmlStatus(skosHtmlManager)%></td>
							    <th class="SkosTableCount"><%=aConcept.getDepth()%></th>
							    <td class="SkosTableConcept"><%=aConcept.toHtmlLabel(skosHtmlManager)%></td><%=skosHtmlTable.toHtmlColumns(aConcept)%></tr><%
				      }
				    %><tr class="floatingHeaders">
						  <th>&nbsp;</th>
						  <th class="math"><%if (skosHtmlTable.isHierarchized() || !expanded) {%>&#8615;<%}%></th>
						  <th<%=skosHtmlTable.toHtmlWholeSpan()%>>&nbsp;</th>
					  <%=skosHtmlTable.toHtmlRoleHeaders()%>
				      </tr></table><%
	      } else if (nbLink > 0) {
	    	%><p><a href="<%=request.getContextPath()%>/concept.jsp?concept=<%=aConcept.getScheme_About()%>&expanded=yes#hierarchy" class="linkaction">Hierarchy</a></p><%
	      }
    %><br style="break:both"/><div class="synonyms collapsiblediv"><%
      if (aConcept.getPrefLabel() != null || edit) { %><ul class="unicode"><% }
      if (aConcept.getPrefLabel() != null) {
		for (Term aTerm: aConcept.getPrefLabel()) {
		     String aLang = Util.fixColumns(aTerm.getLang(),2);
	      %><li><b><span class="math" style="color:darkgreen;">&#9755;</span></b><%
		  if (edit) { %><%=skosHtmlManager.toHtmlEdit(aConcept,"prefLabel",aTerm)%><%
		  } %><a class="linkactionsmaller" href="<%=aConcept.getAskosiUrl(skosHtmlManager,"&graf="+aTerm.getLang())%>#Graf" title="Graf"><span class="language">
				      <%=aLang%> </span></a> <span itemprop="name" lang="<%=aLang%>"><%=aTerm.toHtmlValue()%></span><%=skosHtmlManager.toHtmlSource(aTerm.getSource())%></li><%
		}
      }
	  if (edit) { %><li><b><span class="math" style="color:darkgreen;">&#9755;</span></b><%=skosHtmlManager.toHtmlEdit(aConcept,"prefLabel",null)%></li><% }
	  if (aConcept.getPrefLabel() != null || edit) { %></ul><% }

	  String aNote = aConcept.getInternalNote();
	  if (aNote != null && !aNote.isEmpty()) {
		%><p><%=aNote%></p><%
	  }

      if (aConcept.getCollectionScheme() != null && !aConcept.getCollectionScheme().isEmpty()) {
		%><h4>Collections: <%
		for (CollectionScheme aCollection: aConcept.getCollectionScheme()) {
		%><span class="math">&#8845;</span><%=aCollection.getAbout()%>:<%=aCollection.getTitle(language)%>; <%
		}
		%></h4><%
      }

      if (aConcept.getAltLabel() != null || edit) { %><ul class="unicode"><% }
	  if (aConcept.getAltLabel() != null) {
		for (Term aTerm: aConcept.getAltLabel()) {
	  %><li><b><span class="math" style="color:darkorange;">&#9755;</span></b><%
				if (edit) { %><%=skosHtmlManager.toHtmlEdit(aConcept,"altLabel",aTerm)%><%
				} %><span class="language"> <%=Util.fixColumns(aTerm.getLang(),2)%> </span> <%=aTerm.toHtmlValue()%><%=skosHtmlManager.toHtmlSource(aTerm.getSource())%></li><%
		}
      }
	  if (edit) { %><li><b><span class="math" style="color:darkorange;">&#9755;</span></b><%=skosHtmlManager.toHtmlEdit(aConcept,"altLabel",null)%></li><% }
	  if (aConcept.getAltLabel() != null || edit) { %></ul><% }

      if (aConcept.getHiddenLabel() != null || edit) { %><ul class="unicode"><% }
	  if (aConcept.getHiddenLabel() != null) {
		for (Term aTerm: aConcept.getHiddenLabel()) {
	  %><li><b><span class="math" style="color:darkred;">&#9755;</span></b><%if (edit) {
				%><%=skosHtmlManager.toHtmlEdit(aConcept,"hiddenLabel",aTerm)%><%
				} %><span class="language"><%=Util.fixColumns(aTerm.getLang(),2)%> </span> <%=aTerm.toHtmlValue()%><%=skosHtmlManager.toHtmlSource(aTerm.getSource())%></li><%
		}
      }
	  if (edit) { %><li><b><span class="math" style="color:darkred;">&#9755;</span></b><%=skosHtmlManager.toHtmlEdit(aConcept,"hiddenLabel",null)%></li><% }
      if (aConcept.getHiddenLabel() != null || edit) { %></ul><% }
	  %></div><br style="break:both"/><div class="notations collapsiblediv"><%
	  if (edit || (aConcept.getAlias() != null && !aConcept.getAlias().isEmpty())) {
		%><h4><%
		if (!edit) { %>Alias: <% }
		if (aConcept.getAlias() != null) {
			for (LocalLinkedConcept anAlias: aConcept.getAlias()) {
				String anAbout = anAlias.getAbout();
		  %><span class="math">&#8863;</span><%
				if (edit) { %><%=skosHtmlManager.toHtmlEdit(aConcept,"alias",anAlias)%><%
				} %><%=anAbout%>; <%
			}
		}
		if (edit) { %><span class="math">&#8863;</span><%=skosHtmlManager.toHtmlEdit(aConcept,"alias",null)%><% }
		%></h4><%
      }
	  if (edit || (aConcept.getNotation() != null && !aConcept.getNotation().isEmpty())) {
		%><h4><%
		if (!edit) { %>Notations: <% }
		if (aConcept.getNotation() != null) {
			for (Notation aNotation: aConcept.getNotation()) {
		  %><span class="math">&#8862;</span><%
				if (edit) { %><%=skosHtmlManager.toHtmlEdit(aConcept,"notation",aNotation)%><%
				} %><%=aNotation.getScheme()%>_<%=aNotation.getNotation()%>; <%
			}
		}
		if (edit) { %><span class="math">&#8862;</span><%=skosHtmlManager.toHtmlEdit(aConcept,"notation",null)%><% }
		%></h4><%
      }
	%></div><br style="break:both"/><div class="definitions collapsiblediv"><%
/*
*	definition	DEF	#8797			Definition of the concept (like in a dictionnary)
*	scopeNote	SN	#8795			Disambiguation explanation to the user
*	example		#8799			Example
*	historyNote	HN	#8796			History of the evolution of the concept and of its terminology
*	changeNote		#8798			What has been changed in this database about this concept?
*	editorialNote		#10001
*/
      if (edit || aConcept.getDefinition() != null) {
		%><ul class="unicode notes"><%
		if (aConcept.getDefinition() != null) {
			for (Term aTerm: aConcept.getDefinition()) {
				String aLang = Util.fixColumns(aTerm.getLang(),2);
				%><li><b><span class="math">&#8797;</span></b><%
				if (edit) {
					%><%=skosHtmlManager.toHtmlEdit(aConcept,"definition",aTerm)%><%
				} %><span class="language"><%=aLang%> </span> <span itemprop="description" lang="<%=aLang%>"><%=aTerm.toHtmlValue()%></span></li><%
			}
		}
	    if (edit) { 
			%><li><b><span class="math">&#8797;</span></b><%=skosHtmlManager.toHtmlEdit(aConcept,"definition",null)%></li><%
		}
        %></ul><%
      }
	  
      if (edit || aConcept.getScopeNote() != null) {
		%><ul class="unicode notes"><%
		if (aConcept.getScopeNote() != null) {
			for (Term aTerm: aConcept.getScopeNote()) {
				String aLang = Util.fixColumns(aTerm.getLang(),2);
				%><li><b><span class="math">&#8795;</span></b><%
				if (edit) {
					%><%=skosHtmlManager.toHtmlEdit(aConcept,"scopeNote",aTerm)%><%
				} %><span class="language"><%=aLang%> </span> <span itemprop="description" lang="<%=aLang%>"><%=aTerm.toHtmlValue()%></span></li><%
			}
		}
	    if (edit) { 
			%><li><b><span class="math">&#8795;</span></b><%=skosHtmlManager.toHtmlEdit(aConcept,"scopeNote",null)%></li><%
		}
        %></ul><%
      }
	  
      if (edit || aConcept.getExample() != null) {
		%><ul class="unicode notes"><%
		if (aConcept.getExample() != null) {
			for (Term aTerm: aConcept.getExample()) {
				%><li><b><span class="math">&#8799;</span></b><%
				if (edit) {
					%><%=skosHtmlManager.toHtmlEdit(aConcept,"example",aTerm)%><%
				} %><span class="language"><%=Util.fixColumns(aTerm.getLang(),2)%> </span> <%=aTerm.toHtmlValue()%></li><%
			}
		}
	    if (edit) { 
			%><li><b><span class="math">&#8799;</span></b><%=skosHtmlManager.toHtmlEdit(aConcept,"example",null)%></li><%
		}
        %></ul><%
      }
	  
      if (edit || aConcept.getHistoryNote() != null) {
		%><ul class="unicode notes"><%
		if (aConcept.getHistoryNote() != null) {
			for (Term aTerm: aConcept.getHistoryNote()) {
				%><li><b><span class="math">&#8796;</span></b><%
				if (edit) {
					%><%=skosHtmlManager.toHtmlEdit(aConcept,"historyNote",aTerm)%><%
				} %><span class="language"><%=Util.fixColumns(aTerm.getLang(),2)%> </span> <%=aTerm.toHtmlValue()%></li><%
			}
		}
	    if (edit) { 
			%><li><b><span class="math">&#8796;</span></b><%=skosHtmlManager.toHtmlEdit(aConcept,"historyNote",null)%></li><%
		}
        %></ul><%
      }
	  
      if (edit || aConcept.getChangeNote() != null) {
		%><ul class="unicode notes"><%
		if (aConcept.getChangeNote() != null) {
			for (Term aTerm: aConcept.getChangeNote()) {
				%><li><b><span class="math">&#8798;</span></b><%
				if (edit) {
					%><%=skosHtmlManager.toHtmlEdit(aConcept,"changeNote",aTerm)%><%
				} %><span class="language"><%=Util.fixColumns(aTerm.getLang(),2)%> </span> <%=aTerm.toHtmlValue()%></li><%
			}
		}
	    if (edit) { 
			%><li><b><span class="math">&#8798;</span></b><%=skosHtmlManager.toHtmlEdit(aConcept,"changeNote",null)%></li><%
		}
        %></ul><%
      }
	  
      if (edit || aConcept.getEditorialNote() != null) {
		%><ul class="unicode notes"><%
		if (aConcept.getEditorialNote() != null) {
			for (Term aTerm: aConcept.getEditorialNote()) {
				%><li><b><span class="math">&#10001;</span></b><%
				if (edit) {
					%><%=skosHtmlManager.toHtmlEdit(aConcept,"editorialNote",aTerm)%><%
				} %><span class="language"><%=Util.fixColumns(aTerm.getLang(),2)%> </span> <%=aTerm.toHtmlValue()%></li><%
			}
		}
	    if (edit) { 
			%><li><b><span class="math">&#10001;</span></b><%=skosHtmlManager.toHtmlEdit(aConcept,"editorialNote",null)%></li><%
		}
        %></ul><%
      }
	  %></div><br style="break:both"/><div style="errors collapsiblediv"><%	  
	  if ( ! aConcept.getErrors().isEmpty()) {
		%><h4><img src="image/concepterror16.gif" border="0"/><%=aConcept.getErrors().size()%> errors:</h4><%=aConcept.toHtmlErrors(skosHtmlManager)%><%
	  }
	  %></div><br style="break:both"/><div style="position: absolute; margin-top:-100px;"><a name="relations"></a></div><div class="relations collapsiblediv"><%
	  nbLink += aConcept.getRelated().size();
  	  nbLink += aConcept.getRelatedMatch().size();
  	  nbLink += aConcept.getExactMatch().size();
  	  nbLink += aConcept.getCloseMatch().size();
  
  	  if (edit || (nbLink > 0)) {
		  if (!edit && !isrelfocus) {
			  %><a href="<%=request.getContextPath()%>/concept.jsp?concept=<%=aConcept.getScheme_About()%>&relfocus=relations#relations"><i><%=nbLink %> relations</i></a><%
		  }
	      List<LocalLinkedConcept> localConcepts;
	      List<LinkedConcept> linkedConcepts;
	      linkedConcepts = aConcept.getExactMatch();
	      if (maxRel >= 0 && (edit || isrelfocus ||  (linkedConcepts != null && !linkedConcepts.isEmpty()))) {
			%><%--h4>Exact Equivalent in another scheme:</h4--%><a name="exactMatch"></a><ul class="relations"><%
			if (linkedConcepts != null) {
				for (LinkedConcept aRelation: linkedConcepts) {
			  %><li style="list-style-image: url('image/role/exactmatch16.gif');"><%--img src="image/role/exactmatch16.gif" border="0"/--%><%=skosHtmlManager.toHtmlRelationQualifier(aRelation.getRelationQualifier())%><%
					  if (edit) { %><%=skosHtmlManager.toHtmlEdit(aConcept,"exactMatch",aRelation)%><%
					  }
					  Concept seeConcept = aRelation.getConcept(skosManager);
					  if (seeConcept == null) { %><%=aRelation.getAbout()%><% }
					  else  { %><%=seeConcept.toHtmlLabel(skosHtmlManager)%><% }
					  %></li><%
				}
			}
			if (edit) { %><li style="list-style-image: url('image/role/exactmatch16.gif');"><%--img src="image/role/exactmatch16.gif" border="0"/--%><%=skosHtmlManager.toHtmlEdit(aConcept,"exactMatch",null)%></li><% }
			%></ul><%
		  }

	      linkedConcepts = aConcept.getCloseMatch();
	      if (maxRel >= 0 && (edit || isrelfocus ||  (linkedConcepts != null && !linkedConcepts.isEmpty()))) {
			%><%--h4>Close Equivalent in another scheme:</h4--%><a name="closeMatch"></a><ul class="relations"><%
			if (linkedConcepts != null) {
				for (LinkedConcept aRelation: linkedConcepts) {
			  %><li style="list-style-image: url('image/role/closematch16.gif');"><%--img src="image/role/closematch16.gif" border="0"/--%><%=skosHtmlManager.toHtmlRelationQualifier(aRelation.getRelationQualifier())%><%
					  if (edit) { %><%=skosHtmlManager.toHtmlEdit(aConcept,"closeMatch",aRelation)%><%
					  }
					  Concept seeConcept = aRelation.getConcept(skosManager);
					  if (seeConcept == null) { %><%=aRelation.getAbout()%><% }
					  else  { %><%=seeConcept.toHtmlLabel(skosHtmlManager)%><% }
					  %></li><%
				}
			}
			if (edit) { %><li style="list-style-image: url('image/role/closematch16.gif');"><%--img src="image/role/closematch16.gif" border="0"/--%><%=skosHtmlManager.toHtmlEdit(aConcept,"closeMatch",null)%></li><% }
			%></ul><%
		  }

	      if ( edit || isrelfocus ) {
			    localConcepts = aConcept.getBroader();
				%><%--h4>Broader:</h4--%><a name="broader"></a><ul class="relations"><%
				if (localConcepts != null) {
					for (LocalLinkedConcept aRelation: localConcepts) {
					  %><li style="list-style-image: url('image/role/broader16.gif');"><%--img src="image/role/broader16.gif" border="0"/--%><%=skosHtmlManager.toHtmlRelationQualifier(aRelation.getRelationQualifier())%><%
					  if (edit) { %><%=skosHtmlManager.toHtmlEdit(aConcept,"broader",aRelation)%><%
					  }
					  Concept seeConcept = aRelation.getConcept(aScheme);
					  if (seeConcept == null) { %><%=aRelation.getAbout()%><% }
					  else  {
						%><%=seeConcept.toHtmlLabel(skosHtmlManager)%><%
					  }
					  %></li><%
					}
				}
				if (edit) { %><li style="list-style-image: url('image/role/broader16.gif');"><%--img src="image/role/broader16.gif" border="0"/--%><%=skosHtmlManager.toHtmlEdit(aConcept,"broader",null)%></li><% }
				%></ul><%
	      } else {
	    	  %><div style="position: absolute; margin-top:-100px;"><a name="broader"></a><a name="narrower"></a></div><%
	      }

	      linkedConcepts = aConcept.getBroadMatch();
	      if ( edit || isrelfocus ) {
		%><%--h4>Context:</h4--%><a name="broadMatch"></a><ul class="relations"><%
			if (linkedConcepts != null) {
				for (LinkedConcept aRelation: linkedConcepts) {
			  %><li style="list-style-image: url('image/role/broadermatch16.gif');"><%--img src="image/role/broadermatch16.gif" border="0"/--%><%=skosHtmlManager.toHtmlRelationQualifier(aRelation.getRelationQualifier())%><%
					  if (edit) { %><%=skosHtmlManager.toHtmlEdit(aConcept,"broadMatch",aRelation)%><%
					  }
					  Concept seeConcept = aRelation.getConcept(skosManager);
					  if (seeConcept == null) { %><%=aRelation.getAbout()%><% }
					  else  { %><%=seeConcept.toHtmlLabel(skosHtmlManager)%><% }
					  %></li><%
				}
			}
			if (edit) { %><li style="list-style-image: url('image/role/broadermatch16.gif');"><%--img src="image/role/broadermatch16.gif" border="0"/--%><%=skosHtmlManager.toHtmlEdit(aConcept,"broadMatch",null)%></li><% }
			%></ul><%
		 }
			  localConcepts = aConcept.getNarrower();
			  if ( edit || isrelfocus ) {
				    %><%--h4>Narrower:</h4--%><a name="narrower"></a><ul class="relations"><%
					if (localConcepts != null) {
						for (LocalLinkedConcept aRelation: localConcepts) {
						  %><li style="list-style-image: url('image/role/narrower16.gif');"><%--img src="image/role/narrower16.gif" border="0"/--%><%=skosHtmlManager.toHtmlRelationQualifier(aRelation.getRelationQualifier())%><%
						  if (edit) { %><%=skosHtmlManager.toHtmlEdit(aConcept,"narrower",aRelation)%><%
						  }
						  Concept seeConcept = aRelation.getConcept(aScheme);
						  if (seeConcept == null) { %><%=aRelation.getAbout()%><% }
						  else  { %><%=seeConcept.toHtmlLabel(skosHtmlManager)%><% }
						  %></li><%
						}
					}
					if (edit) { %><li style="list-style-image: url('image/role/narrower16.gif');"><%--img src="image/role/narrower16.gif" border="0"/--%><%=skosHtmlManager.toHtmlEdit(aConcept,"narrower",null)%></li><% }
				    %></ul><%
			  }

	      linkedConcepts = aConcept.getNarrowMatch();
	      if ( edit || isrelfocus ) {
		%><%--h4>Specifics in another scheme:</h4--%><a name="narrowMatch"></a><ul class="relations"><%
			if (linkedConcepts != null) {
				for (LinkedConcept aRelation: linkedConcepts) {
			  %><li style="list-style-image: url('image/role/narrowmatch16.gif');"><%--img src="image/role/narrowmatch16.gif" border="0"/--%><%=skosHtmlManager.toHtmlRelationQualifier(aRelation.getRelationQualifier())%><%
					  if (edit) { %><%=skosHtmlManager.toHtmlEdit(aConcept,"narrowMatch",aRelation)%><%
					  }
					  Concept seeConcept = aRelation.getConcept(skosManager);
					  if (seeConcept == null) { %><%=aRelation.getAbout()%><% }
					  else  { %><%=seeConcept.toHtmlLabel(skosHtmlManager)%><% }
					  %></li><%
				}
			}
			if (edit) { %><li style="list-style-image: url('image/role/narrowmatch16.gif');"><%--img src="image/role/narrowmatch16.gif" border="0"/--%><%=skosHtmlManager.toHtmlEdit(aConcept,"narrowMatch",null)%></li><% }
			%></ul><%
		  }

	      localConcepts = aConcept.getRelated();
	      if (edit || isrelfocus ||  maxRel < 0) {
			%><%--h4>See also:</h4--%><a name="related"></a><ul class="relations"><%
			if (localConcepts != null) {
				for (LocalLinkedConcept aRelation: localConcepts) {
			  %><li style="list-style-image: url('image/role/related16.gif');"><%--img src="image/role/related16.gif" border="0"/--%><%=skosHtmlManager.toHtmlRelationQualifier(aRelation.getRelationQualifier())%><%
					  if (edit) { %><%=skosHtmlManager.toHtmlEdit(aConcept,"related",aRelation)%><%
					  }
					  Concept seeConcept = aRelation.getConcept(aScheme);
					  if (seeConcept == null) { %><%=aRelation.getAbout()%><% }
					  else  { %><%=seeConcept.toHtmlLabel(skosHtmlManager)%><% }
					  %></li><%
				}
			}
			if (edit) { %><li style="list-style-image: url('image/role/related16.gif');"><%--img src="image/role/related16.gif" border="0"/--%><%=skosHtmlManager.toHtmlEdit(aConcept,"related",null)%></li><% }
			%></ul><%
		  }

	      linkedConcepts = aConcept.getRelatedMatch();
	      if (edit || isrelfocus ||  maxRel < 0) {
			%><%--h4>See also in another scheme:</h4--%><a name="relatedMatch"></a><ul class="relations"><%
			if (linkedConcepts != null) {
				for (LinkedConcept aRelation: linkedConcepts) {
			  %><li style="list-style-image: url('image/role/relatedmatch16.gif');"><%--img src="image/role/relatedmatch16.gif" border="0"/--%><%=skosHtmlManager.toHtmlRelationQualifier(aRelation.getRelationQualifier())%><%
					  if (edit) { %><%=skosHtmlManager.toHtmlEdit(aConcept,"relatedMatch",aRelation)%><%
					  }
					  Concept seeConcept = aRelation.getConcept(skosManager);
					  if (seeConcept == null) { %><%=aRelation.getAbout()%><% }
					  else  { %><%=seeConcept.toHtmlLabel(skosHtmlManager)%><% }
					  %></li><%
				}
			}
			if (edit) { %><li style="list-style-image: url('image/role/relatedmatch16.gif');"><%--img src="image/role/relatedmatch16.gif" border="0"/--%><%=skosHtmlManager.toHtmlEdit(aConcept,"relatedMatch",null)%></li><% }
			%></ul><%
		  }
  	  }
%></div><%
	Log aLogEntry = usageLogger.stop();
  %><div>Displayed: <%=usageLogger.count()%> time, last: <%=usageLogger.getNow()%></div>
  <div id="statement" style="border: 1px solid blue; display:none; position: absolute; width:440px; background-color:#fec">
  	<div style="float:right;background-color:#eef">&nbsp;Profile:<%=skosHtmlManager.getProfileData().getAbout()%>&nbsp;<a href="javascript:closePanel()"><img<%=skosHtmlManager.askosiIcon("close")%>></a></div>
    <div id="editStatement"></div>
  </div>
<%
  } else {%>
<h3>Concept <%=conceptCode%> does not exist.</h3>
<%}%>
</div>
<p>Thesaurus navigation and maintenance, Indexation browsing are services developed in the <a href="http://www.askosi.org">ASKOSI</a> project.</p>
    <script type="text/javascript">
	$('div.collapsiblediv:empty').hide();
    </script>
</body></html>
